package com.sfac.modules.account.controller;

import com.sfac.modules.account.domain.Role;
import com.sfac.modules.account.service.RoleService;
import com.sfac.modules.common.vo.Result;
import com.sfac.modules.common.vo.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:唐琳的爹
 * @BelongsProject:hqyj_springboot
 * @BelongsPackage:com.sfac.modules.account.controller
 * @CreateTime:2022/8/28 20:01:21
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private RoleService roleService;


    /**
     * 获取所有角色
     * @return
     */
    @GetMapping("/getAllRoles")
    public Result<Role> getAllRoles(){
        List<Role> roles = roleService.list();
        return new Result<>(StatusCode.SUCCESS,"成功!",roles);
    }
}
